/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine;

import it.free.i.Factory;
import it.free.i.SystemFactory;
import it.free.i.naming.NamingBuilder;

/**  
 * Virtual machine implementation factory
 * @author stefano
 */
public class VirtualMachineFactory extends SystemFactory implements Factory {

	public static String CONTEXT = null;
	private static final String MY_CONTEXT = "cn=VirtualMachine";
	
	static{
		CONTEXT = NamingBuilder.buildLookupName(MY_CONTEXT, SystemFactory.CONTEXT);
	}
	
	/**
	 * No need to make possible to create instances
	 * Singleton makes it private, no creation from outside
	 */
	public VirtualMachineFactory(){
		super();
	}
	
	/**
	 * Create a class by its FQ name
	 * @param name of the object to create
	 * @return an instance of the object
	 * @throws Exception
	 */
	public Object createObject(String name) throws Exception {
		
		String fullyQualifiedJndiName = NamingBuilder.buildLookupName(name, VirtualMachineFactory.CONTEXT);
		
		return super.createObject(fullyQualifiedJndiName);
	}
}
